package com.example.book.enums;

import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/7/26
 * Time: 01:44
 */
@Getter
public enum BookStatus {

    DELETE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;

    BookStatus(Integer code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    private Integer code;
    private String describe;

    public static BookStatus getDescribeByCode(Integer code) {
        return switch (code) {
            case 0 -> DELETE;
            case 1 -> NORMAL;
            default -> FORBIDDEN;
        };
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }
}
